package com.noreply.demo.controller;

import com.noreply.demo.dto.Resp;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author noreply
 * @description
 * @datetime 2021/6/23 17:25
 */
@RestController
public class HelloController extends BaseController{
    @ExceptionHandler
    @Override
    public Resp errorHandle(Exception e) {
        return fail(e.getMessage(), e);
    }

    @GetMapping("/hello/{id}")
    public Resp hello(@PathVariable("id") int id) {
        return success(10/id);
    }
}
